/** @file Button.qml
@brief The Qt-Complex standard button

@authorname \n
@licenseversion \n
@actualversion - @dateupdate

@licensenote
*/
import QtQuick 1.0
import "Theme.js" as JsObj

BorderImage {
    id: button

    signal objClicked

    source: JsObj.getButton(objLoad.getTheme()); clip: true
    border { left: 10; top: 10; right: 10; bottom: 10 }

    width: objLoad.getWidth()
    height: objLoad.getHeight()

    // Shade is set over the button image when it is presed
    Rectangle { id: shade; anchors.fill: button; radius: 5; color: "black"; opacity: 0 }

    // Font Size is set based on the button shorter side
    Text {
        id: buttonText
        anchors.centerIn: parent;
        font.pointSize: objLoad.getFontPoints()
        text: objLoad.getString();
        style: Text.Sunken; color: "white"; styleColor: "black"; smooth: true
    }

    MouseArea {
        id: mouseArea
        anchors.fill: parent
        onClicked: { button.objClicked(); }
    }

    // When button is pressed the shade changes
    states: State {
        name: "pressed"; when: mouseArea.pressed == true
        PropertyChanges { target: shade; opacity: .2 }
    }
}
